﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="headContent" runat="server">
    <style type="text/css">
        table.schedule tr td
        {
            width: 130px;
            height: 100px;
        }
        table.schedule tr th
        {
            width: 130px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <h2>
            <%= CalendarioHelper.ObterMesPorExtenso(Convert.ToInt16(ViewData["mes"])) %>
            de
            <%= ViewData["ano"] %></h2>
        <%
            DateTime data = new DateTime(Convert.ToInt16(ViewData["ano"]), Convert.ToInt16(ViewData["mes"]), 1);
            byte diasEmBranco = CalendarioHelper.ObterQtdeDiaEmBranco(data.DayOfWeek);
            
        %>
    </div>
    <table class="schedule">
        <thead>
            <tr>
                <th>
                    Segunda
                </th>
                <th>
                    Terça
                </th>
                <th>
                    Quarta
                </th>
                <th>
                    Quinta
                </th>
                <th>
                    Sexta
                </th>
                <th>
                    Sábado
                </th>
                <th>
                    Domingo
                </th>
            </tr>
        </thead>
        <tbody>
            <% 
                byte dia = 1;
                byte totaldiasEmBranco = diasEmBranco;
                for (byte celula = 1; celula <= Convert.ToByte(ViewData["qtdeDias"]) + totaldiasEmBranco; celula++)
                {
                           
            %>
            <% if ((celula - 1) % 7 == 0)
               {%>
            <tr>
                <% } %>
                <% if (diasEmBranco > 0)
                   {%>
                <td>
                </td>
                <% 
                           diasEmBranco--;
                       }
                   else
                   { %>
                <td>
                    <div>
                        <%: dia%>
                        <% dia++; %>
                    </div>
                    <div style="height: 90px;">
                    </div>
                </td>
                <%} %>
                <% if (celula % 7 == 0)
                   {%>
            </tr>
            <% } %>
            <%} %>
        </tbody>
    </table>
</asp:Content>
